<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/default.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.4.2.min.js"></script> 
<script src="${pageContext.request.contextPath}/js/jquery.floatbox.10.4.min.js" type="text/javascript"></script>
<script language="JavaScript">

$(document).ready(function(){
	
	$(".editpicture").click(function () {
	    $.floatbox({
	        ajax: {
	            url: "editPicture.action?pictureId="+$(this).attr('id'),
	          //  params: "codeValueId="+$(this).attr('id'), //post parameters
	            before: "<p>Loading content</p>", //loading message while the request is being processed
	            finish: function () {
	               
	            }
	        },
	        fade: true
	    });
	});
	
	$(".addPicture").click(function () {
	    $.floatbox({
	        ajax: {
	            url: "addPicture.action?productId="+$(this).attr('id'),
	          //  params: "codeValueId="+$(this).attr('id'), //post parameters
	            before: "<p>Loading content</p>", //loading message while the request is being processed
	            finish: function () {
	               
	            }
	        },
	        fade: true
	    });
	});
	
});
</script>
<title><font color="red"><s:property value="product.name"/></font>的图片管理</title>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">

	<table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#336600">
    	<tr> 
      		<td width="100%" bgcolor="#669900"><strong><font color="red" size="3"><s:property value="product.name"/></font><font color="#FFFFFF">的图片管理</font></strong></td>
    	</tr>
    	<tr align="center" bgcolor="#F9F9F9"> 
      		<td>
      			<table height="0%" width="98%" cellspacing="1" cellpadding="3" border="0">
          			<tr>
          				<td colspan="7">
          					<table>
          						<tr>
			          				<td colspan="2" align="left">　 
						              	<input type="button" name="Submit22" value="添加图片" id='<s:property value="%{product.id}"/>' class="addPicture"> 
						            </td>			            			
			            		</tr>
	            			</table>
	            		</td>
          			</tr>
		          	<tr bgcolor="#669900"> 
		          		<td align="right"><font color="#FFFFFF">&nbsp;</font></td>
			            <td><font color="#FFFFFF"><strong>名称</strong></font></td>
			            <td><font color="#FFFFFF"><strong>描述</strong></font></td>
			            <td width="15%" align="center"><font color="#FFFFFF"><strong>操作</strong></font></td>
		          	</tr>
		          <s:set name="num" value="0"></s:set>
                       <s:iterator value="product.pictures" var="pic">
                                   
				           <tr bgcolor="#f9f9f9"> 
								<td height="35%" width="8%" align="center"><s:property value="#num"/></td>
								<td height="35%" width="16%"> 
									<img src='${pageContext.request.contextPath}/<s:property value="path"/>' width="100" height="100"/>
								</td>
								<td> 
									<s:property value="description"/>
								</td>
								<td height="35%" width="22%" align="center">                 									   
									<img hspace="5" align="absmiddle" src="${pageContext.request.contextPath}/images/admin/delenews.gif"><a href='<s:url value="deletePicture.action"><s:param name="pictureId" value="%{#pic.id}"/></s:url>' >删除</a> 
									<img hspace="5" align="absmiddle" src="${pageContext.request.contextPath}/images/admin/setuser.gif"><a href='#' id='<s:property value="%{#pic.id}"/>' class="editpicture">编辑</a> 
									<a href='<s:url value="setPictureAsDefault.action"><s:param name="pictureId" value="%{#pic.id}"/><s:param name="productId" value="%{product.id}"/></s:url>'>设为默认</a>   
								</td>
							</tr>
							<s:set name="num" value="%{#num+1}"/>
                         </s:iterator>
          		  	<tr> 
            			<td colspan="4" align="center"> <hr width="95%" style="color:#669900"></td>
          			</tr>
          			
        		</table>
      		</td>
    	</tr>
  	</table>

</body>
</html>